<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="root">

    </div>
</body>
<script src="../react@17.js"></script>
<script src="../react-dom@17.js"></script>
<script src="../babel.js"></script>
<script type="text/babel">
    class App extends React.Component {
        render() {
            return (
                <div>
                   {
                    /* 绑定ref属性用于获取标签真实dom */
                   }
                    <h1 ref='myh1'>好好学习天天向上</h1>
                    <h2 ref='myh2'>学习使我快乐</h2>
                    <button onClick={()=>{
                        console.log(this)
                        // this.refs.ref属性名获取真实dom
                        this.refs.myh1.style.color='red';
                        this.refs.myh2.style.color='blue'
                    }}>改变样式</button>
                </div>
            )
        }
    }

    ReactDOM.render(<App />, document.getElementById("root"));
</script>

</html>